In the prior art, a data access speed of an in-memory database is generally improved by using an indexing technology. There are various types of indexes, for example, a multiway search tree (B*tree) index and a Hash index. In a B*tree, each node includes a quantity of keys included in this node, a pointer pointing to a parent node, a key, and a pointer, of the key, pointing to a child node. If the node has no parent node, in other words, the node is a root node, the node does not include a pointer pointing to a parent node; and if the node has no child node, that is, the node is a leaf node, the leaf node points to actual data to which a key of the leaf node points, and no key of a child node is greater than a key of a parent node to which a pointer of the child node points.
FIG. 1 shows a typical example of a B*tree. A node at a top layer is a root node and is a query entrance, and INF is the value of infinity. For example, if we need to search a query B*tree for a value with a key of 28, first, the root node is searched for a smallest key greater than or equal to 28, where the key is 56; then, a child node of the key 56 is found according to a pointer, of the key 56, pointing to the child node; then, the child node is searched for a smallest key greater than or equal to 28, where the key is 35; and a child node of the key 35 is subsequently found according to a pointer, of the key 35, pointing to the child node, so as to find, in the child node, a leaf node having a key of 28.
From the perspective of the foregoing process of searching the B*tree for a numeric value, when query is performed, the root node is searched first, and if a condition is met, a child node of a corresponding key is searched. Therefore, the root node inevitably becomes a hotspot. In a database, a write-once read-many concurrency mechanism is usually used, namely, a shared lock is added for read, and an exclusive lock is added for write. In this way, the root node may be read by many different transactions by adding a shared lock, and the root node may be written by only one transaction by adding an exclusive lock.
However, when the root node is written by only one transaction, no read operation of other transactions can be performed. In addition, because all query requests start from the root node, concurrent processing efficiency is very low.